home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / Basic / Visual Basic.60 / VB98 / WIZARDS / PDWIZARD / SETUP1 / SETUP1.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-06-18  |  25.8 KB  |  691 lines

  1. VERSION 5.00
  2. Begin VB.Form frmSetup1 
  3.    AutoRedraw      =   -1  'True
  4.    BackColor       =   &H00400000&
  5.    BorderStyle     =   0  'None
  6.    Caption         =   "VB5 Setup Toolkit"
  7.    ClientHeight    =   1770
  8.    ClientLeft      =   225
  9.    ClientTop       =   1590
  10.    ClientWidth     =   7950
  11.    ClipControls    =   0   'False
  12.    DrawStyle       =   5  'Transparent
  13.    FillStyle       =   0  'Solid
  14.    BeginProperty Font 
  15.       Name            =   "Times New Roman"
  16.       Size            =   24
  17.       Charset         =   0
  18.       Weight          =   700
  19.       Underline       =   0   'False
  20.       Italic          =   -1  'True
  21.       Strikethrough   =   0   'False
  22.    EndProperty
  23.    ForeColor       =   &H00000000&
  24.    Icon            =   "setup1.frx":0000
  25.    LinkMode        =   1  'Source
  26.    LockControls    =   -1  'True
  27.    MaxButton       =   0   'False
  28.    MinButton       =   0   'False
  29.    PaletteMode     =   1  'UseZOrder
  30.    ScaleHeight     =   118
  31.    ScaleMode       =   3  'Pixel
  32.    ScaleWidth      =   530
  33.    WhatsThisHelp   =   -1  'True
  34.    WindowState     =   2  'Maximized
  35.    Begin VB.Label lblModify 
  36.       AutoSize        =   -1  'True
  37.       BorderStyle     =   1  'Fixed Single
  38.       Caption         =   $"setup1.frx":0442
  39.       BeginProperty Font 
  40.          Name            =   "MS Sans Serif"
  41.          Size            =   8.25
  42.          Charset         =   0
  43.          Weight          =   400
  44.          Underline       =   0   'False
  45.          Italic          =   0   'False
  46.          Strikethrough   =   0   'False
  47.       EndProperty
  48.       Height          =   450
  49.       Left            =   15
  50.       TabIndex        =   1
  51.       Top             =   15
  52.       Visible         =   0   'False
  53.       Width           =   7860
  54.       WordWrap        =   -1  'True
  55.    End
  56.    Begin VB.Label lblDDE 
  57.       AutoSize        =   -1  'True
  58.       BorderStyle     =   1  'Fixed Single
  59.       Caption         =   "This label is used for DDE connection to the Program Manager"
  60.       BeginProperty Font 
  61.          Name            =   "MS Sans Serif"
  62.          Size            =   8.25
  63.          Charset         =   0
  64.          Weight          =   400
  65.          Underline       =   0   'False
  66.          Italic          =   0   'False
  67.          Strikethrough   =   0   'False
  68.       EndProperty
  69.       Height          =   255
  70.       Left            =   15
  71.       TabIndex        =   0
  72.       Top             =   1515
  73.       Visible         =   0   'False
  74.       Width           =   4485
  75.    End
  76. Attribute VB_Name = "frmSetup1"
  77. Attribute VB_GlobalNameSpace = False
  78. Attribute VB_Creatable = False
  79. Attribute VB_PredeclaredId = True
  80. Attribute VB_Exposed = False
  81. Option Explicit
  82. Option Compare Text
  83. ' Can't put this is a resource because it indicated resource load failure, must localize separately
  84. Const mstrRESOURCELOADFAIL$ = "An error occurred while initializing string resources used by Setup."
  85. '-----------------------------------------------------------
  86. ' SUB: DrawBackGround
  87. ' Draws the 'blue wash' screen and prints the 'shadowed'
  88. ' app setup title
  89. '-----------------------------------------------------------
  90. Private Sub DrawBackGround()
  91.     Const intBLUESTART% = 255
  92.     Const intBLUEEND% = 0
  93.     Const intBANDHEIGHT% = 2
  94.     Const intSHADOWSTART% = 8
  95.     Const intSHADOWCOLOR% = 0
  96.     Const intTEXTSTART% = 4
  97.     Const intTEXTCOLOR% = 15
  98.     Const intRed% = 1
  99.     Const intGreen% = 2
  100.     Const intBlue% = 4
  101.     Const intBackRed% = 8
  102.     Const intBackGreen% = 16
  103.     Const intBackBlue% = 32
  104.     Dim sngBlueCur As Single
  105.     Dim sngBlueStep As Single
  106.     Dim intFormHeight As Integer
  107.     Dim intFormWidth As Integer
  108.     Dim intY As Integer
  109.     Dim iColor As Integer
  110.     Dim iRed As Single, iBlue As Single, iGreen As Single
  111.     '
  112.     'Get system values for height and width
  113.     '
  114.     intFormHeight = ScaleHeight
  115.     intFormWidth = ScaleWidth
  116.     If ReadIniFile(gstrSetupInfoFile, gstrINI_SETUP, gstrINI_COLOR) = vbNullString Then
  117.         iColor = intBlue
  118.     Else
  119.         iColor = CInt(ReadIniFile(gstrSetupInfoFile, gstrINI_SETUP, gstrINI_COLOR))
  120.     End If
  121.     'Calculate step size and blue start value
  122.     '
  123.     sngBlueStep = intBANDHEIGHT * (intBLUEEND - intBLUESTART) / intFormHeight
  124.     sngBlueCur = intBLUESTART
  125.     '
  126.     'Paint blue screen
  127.     '
  128.     For intY = 0 To intFormHeight Step intBANDHEIGHT
  129.         If iColor And intBlue Then iBlue = sngBlueCur
  130.         If iColor And intRed Then iRed = sngBlueCur
  131.         If iColor And intGreen Then iGreen = sngBlueCur
  132.         If iColor And intBackBlue Then iBlue = 255 - sngBlueCur
  133.         If iColor And intBackRed Then iRed = 255 - sngBlueCur
  134.         If iColor And intBackGreen Then iGreen = 255 - sngBlueCur
  135.         Line (-1, intY - 1)-(intFormWidth, intY + intBANDHEIGHT), RGB(iRed, iGreen, iBlue), BF
  136.         sngBlueCur = sngBlueCur + sngBlueStep
  137.     Next intY
  138.     '
  139.     'Print 'shadowed' appname
  140.     '
  141.     CurrentX = intSHADOWSTART
  142.     CurrentY = intSHADOWSTART
  143.     ForeColor = QBColor(intSHADOWCOLOR)
  144.     Print Caption
  145.     CurrentX = intTEXTSTART
  146.     CurrentY = intTEXTSTART
  147.     ForeColor = QBColor(intTEXTCOLOR)
  148.     Print Caption
  149. End Sub
  150. Private Sub Form_Load()
  151. ' Most of the work for Setup1 takes place in Form_Load()
  152. ' and is mostly driven by the information found in the
  153. ' SETUP.LST file.  To customize the Setup1 functionality,
  154. ' you will generally want to modify SETUP.LST.
  155. ' Particularly, information regarding the files you are
  156. ' installing is all stored in SETUP.LST.  The only
  157. ' exceptions are the Remote Automation files RacMgr32.Exe
  158. ' and AutMgr32.Exe which require special handling below
  159. ' with regards to installing their icons in a special
  160. ' program group.
  161. ' Some customization can also be done by editing the code
  162. ' below in Form_Load or in other parts of this program.
  163. ' Places that are more likely to need customization are
  164. ' documented with suggestions and examples in the code.
  165.     Const strEXT_GRP$ = "GRP"                               'extension for progman group
  166.     Const SW_HIDE = 0
  167.     Dim strGroupName As String                              'Name of Program Group
  168.     Dim sFile As FILEINFO                                   'first Files= line info
  169.     Dim oFont As StdFont
  170.     gfRegDAO = False
  171.     On Error GoTo MainError
  172.     SetFormFont Me
  173.     'All the controls and the form are sharing the
  174.     'same font object, so create a new font object
  175.     'for the form so that the appearance of all the
  176.     'controls are not changed also
  177.     Set oFont = New StdFont
  178.     With oFont
  179.         .Size = 24
  180.         .Bold = True
  181.         .Italic = True
  182.         .Charset = Me.lblModify.Font.Charset
  183.         .Name = Me.lblModify.Font.Name
  184.     End With
  185.     Set Me.Font = oFont
  186.     '
  187.     'Initialize string resources used by global vars and forms/controls
  188.     '
  189.     GetStrings
  190.     '
  191.     'Get Windows, Windows\Fonts, and Windows\System directories
  192.     '
  193.     gstrWinDir = GetWindowsDir()
  194.     gstrWinSysDir = GetWindowsSysDir()
  195.     gstrFontDir = GetWindowsFontDir()
  196.     '
  197.     ' If the Windows System directory is a subdirectory of the
  198.     ' Windows directory, the proper place for installation of
  199.     ' files specified in the setup.lst as $(WinSysDest) is always
  200.     ' the Windows \System directory.  If the Windows \System
  201.     ' directory is *not* a subdirectory of the Windows directory,
  202.     ' then the user is running a shared version of Windows.  In
  203.     ' this case, if the user does not have write access to the
  204.     ' shared system directory, we change the system files
  205.     ' destination to the windows directory
  206.     '
  207.     If InStr(gstrWinSysDir, gstrWinDir) = 0 Then
  208.         If WriteAccess(gstrWinSysDir) = False Then
  209.             gstrWinSysDir = gstrWinDir
  210.         End If
  211.     End If
  212.     '
  213.     ' The command-line arguments must be processed as early
  214.     ' as possible, because without them it is impossible to
  215.     ' call the app removal program to clean up after an aborted
  216.     ' setup.
  217.     '
  218.     ProcessCommandLine Command$, gfSilent, gstrSilentLog, gfSMS, gstrMIFFile, gstrSrcPath, gstrAppRemovalLog, gstrAppRemovalEXE
  219.     gfNoUserInput = (gfSilent Or gfSMS)
  220.     AddDirSep gstrSrcPath
  221.     '
  222.     ' The Setup Bootstrapper (SETUP.EXE) copies SETUP1.EXE and SETUP.LST to
  223.     ' the end user's windows directory.  Information required for setup such
  224.     ' as setup flags and fileinfo is read from the copy of SETUP.LST found in
  225.     ' that directory.
  226.     '
  227.     gstrSetupInfoFile = gstrWinDir & gstrFILE_SETUP
  228.     'Get the Appname (this will be shown on the blue wash screen)
  229.     gstrAppName = ReadIniFile(gstrSetupInfoFile, gstrINI_SETUP, gstrINI_APPNAME)
  230.     gintCabs = CInt(ReadIniFile(gstrSetupInfoFile, gstrINI_BOOT, gstrINI_CABS))
  231.     If gstrAppName = vbNullString Then
  232.         MsgError ResolveResString(resNOSETUPLST), vbOKOnly Or vbCritical, gstrSETMSG
  233.         gstrTitle = ResolveResString(resSETUP, "|1", gstrAppName)
  234.         ExitSetup Me, gintRET_FATAL
  235.     End If
  236.     gstrAppExe = ReadIniFile(gstrSetupInfoFile, gstrINI_SETUP, gstrINI_APPEXE)
  237.     gstrTitle = ResolveResString(resSETUP, "|1", gstrAppName)
  238.     If gfSilent Then LogSilentMsg gstrTitle & vbCrLf
  239.     Dim lChar As Long
  240.     gsTEMPDIR = String$(255, 0)
  241.     lChar = GetTempPath(255, gsTEMPDIR)
  242.     gsTEMPDIR = Left(gsTEMPDIR, lChar)
  243.     AddDirSep gstrSrcPath
  244.     gsCABNAME = gstrSrcPath & ReadIniFile(gstrSetupInfoFile, gstrINI_BOOT, gstrINI_CABNAME)
  245.     gsCABNAME = GetShortPathName(gsCABNAME)
  246.     gsCABNAME = gstrWinDir & BaseName(gsCABNAME)
  247.     gsTEMPDIR = gsTEMPDIR & ReadIniFile(gstrSetupInfoFile, gstrINI_BOOT, gsINI_TEMPDIR)
  248.     AddDirSep gsTEMPDIR
  249.     '
  250.     ' Display the background "blue-wash" setup screen as soon as we get the title
  251.     '
  252.     ShowMainForm
  253.     '
  254.     ' Display the welcome dialog
  255.     '
  256.     ShowWelcomeForm
  257.     '
  258.     ' If this flag is set, then the default destination directory is used
  259.     ' without question, and the user is never given a chance to change it.
  260.     ' This is intended for installing an .EXE/.DLL as a component rather
  261.     ' than as an application in an application directory.  In this case,
  262.     ' having an application directory does not really make sense.
  263.     '
  264.     If ReadIniFile(gstrSetupInfoFile, gstrINI_SETUP, gstrINI_FORCEUSEDEFDEST) = "1" Then
  265.         gfForceUseDefDest = True
  266.     End If
  267.     '
  268.     ' Read default destination directory.  If the name specified conflicts
  269.     ' with the name of a file, then prompt for a new default directory
  270.     '
  271.     gstrDestDir = ResolveDestDir(ReadIniFile(gstrSetupInfoFile, gstrINI_SETUP, gstrINI_APPDIR))
  272.     While FileExists(gstrDestDir) = True Or gstrDestDir = vbNullString
  273.         If MsgError(ResolveResString(resBADDEFDIR), vbOKCancel Or vbQuestion, gstrSETMSG) = vbCancel Then
  274.             ExitSetup Me, gintRET_FATAL
  275.         End If
  276.         
  277.         If gfNoUserInput = True Then
  278.             ExitSetup Me, gintRET_FATAL
  279.         Else
  280.             ShowPathDialog gstrDIR_DEST
  281.         End If
  282.     Wend
  283.     '
  284.     ' Ensure a trailing backslash on the destination directory
  285.     '
  286.     AddDirSep gstrDestDir
  287.     Do
  288.         '
  289.         ' Display install button and default directory.  The user
  290.         ' can change the destination directory from here.
  291.         '
  292.         ShowBeginForm
  293.         '
  294.         ' This would be a good place to display an option dialog, allowing the user
  295.         ' a chance to select installation options: samples, docs, help files, etc.
  296.         ' Results of this dialog would be checked in the loop below
  297.         '
  298.         'ShowOptionsDialog (Function you could write with option check boxes, etc.)
  299.         '
  300.         '
  301.         ' Initialize "table" of drives used and disk space array
  302.         '
  303.         InitDiskInfo
  304.         SetMousePtr vbHourglass
  305.         ShowStaticMessageDialog ResolveResString(resDISKSPACE)
  306.         '
  307.         ' For every section in SETUP.LST that will be installed, call CalcDiskSpace
  308.         ' with the name of the section
  309.         '
  310.         CalcDiskSpace gstrINI_FILES
  311.         'CalcDiskSpace "MySection"
  312.         'CalcDiskSpace "MyOtherSection"
  313.         '
  314.         ' If you created an options dialog, you need to check results here to
  315.         ' determine whether disk space needs to be calculated (if the option(s)
  316.         ' will be installed)
  317.         '
  318.         'If chkInstallSamples.Value = TRUE then
  319.         '    CalcDiskSpace "Samples"
  320.         'End If
  321.         '
  322.         HideStaticMessageDialog
  323.         SetMousePtr vbDefault
  324.     '
  325.     ' After all CalcDiskSpace calls are complete, call CheckDiskSpace to check
  326.     ' the results and display warning form (if necessary).  If the user wants
  327.     ' to try another destination directory (or cleanup and retry) then
  328.     ' CheckDiskSpace will return False
  329.     '
  330.     Loop While CheckDiskSpace() = False
  331.     '
  332.     ' Starts logging to the setup logfile (will be used for application removal)
  333.     '
  334.     EnableLogging gstrAppRemovalLog
  335.     '
  336.     ' Should go ahead and force the application directory to be created,
  337.     ' since the application removal logfile will later be copied there.
  338.     '
  339.     MakePath gstrDestDir, False 'User may not ignore errors here
  340.     '
  341.     ' Create the main program group if one is wanted/needed.
  342.     '
  343.     Const fDefCreateGroupUnderWin95 = False
  344.     '
  345.     ' If fDefCreateGroupUnderWin95 is set to False (this is the default), then no
  346.     ' program group will be created under Win95 unless it is absolutely necessary.
  347.     '
  348.     ' By default under Windows 95, no group should be created, and the
  349.     ' single program icon should be placed directly under the
  350.     ' Start>Programs menu (unless there are other, user-defined icons to create
  351.     '
  352.     Dim cIcons As Integer            ' Count of how many icons are required.
  353.     Dim cGroups As Integer           ' Count of how many groups are required.
  354.     '
  355.     ' Read through the SETUP.LST file and determine how many icons are needed.
  356.     '
  357.     cIcons = CountIcons(gsICONGROUP)
  358.     cGroups = CountGroups(gsICONGROUP)
  359.     '
  360.     ' Do the same for other sections in SETUP.LST if you've added your own.
  361.     '
  362.     'cIcons = cIcons + CountIcons("MySection")
  363.     'cIcons = cIcons + CountIcons("MyOtherSection")
  364.     '
  365.     ' The following variable determines whether or not we create a program
  366.     ' group for icons.  It is controlled by fNoGroupUnderWin95,
  367.     ' fAdditionalIcons, and FTreatAsWin95().
  368.     '
  369.     Dim fCreateGroup As Boolean
  370.     If TreatAsWin95() Then
  371.         '
  372.         ' Win95 only:
  373.         ' We create a program group only if we have additional icons besides
  374.         ' the application executable (if any), or if fDefCreateGroupUnderWin95
  375.         ' has been set to True to override this default behavior.
  376.         '
  377.         fCreateGroup = (cGroups > 0)
  378.     Else
  379.         '
  380.         ' Win32 NT only:
  381.         ' We must always create a Program Manager group
  382.         ' because we always create an icon for the application removal program.
  383.         '
  384.         fCreateGroup = True
  385.     End If
  386.     Dim iLoop As Integer
  387.     If fCreateGroup Then
  388.         For iLoop = 0 To cGroups - 1
  389.             strGroupName = ""
  390.             If (GetGroup(gsICONGROUP, iLoop) = gsSTARTMENUKEY) Or (GetGroup(gsICONGROUP, iLoop) = gsPROGMENUKEY) Then
  391.                 'Skip these, they're not needed.
  392.             Else
  393.                 strGroupName = frmGroup.GroupName(frmSetup1, GetGroup(gsICONGROUP, iLoop), GetPrivate(gsICONGROUP, iLoop), GetStart(gsICONGROUP, iLoop))
  394.                 If GetGroup(gsICONGROUP, iLoop) <> strGroupName Then SetGroup gsICONGROUP, iLoop, strGroupName
  395.             End If
  396.             fMainGroupWasCreated = True
  397.         Next
  398.     End If
  399.     ' Before we begin copying files, check for mdac_typ
  400.     ' and if we find it, spawn that off first.  We will tell
  401.     ' it to never reboot, and check at the end to see if we need to.
  402.     DoEvents
  403.     If CheckDataAccess Then
  404.         'We need to install data access.  Display message.
  405.         ShowStaticMessageDialog ResolveResString(resINSTALLADO)
  406.         InstallDataAccess
  407.         HideStaticMessageDialog
  408.     End If
  409.     '
  410.     ' Show copy form and set copy gauge percentage to zero
  411.     '
  412.     SetMousePtr vbHourglass
  413.     ShowCopyDialog
  414.     UpdateStatus frmCopy.picStatus, 0, True
  415.     '
  416.     ' Always start with Disk #1
  417.     '
  418.     gintCurrentDisk = 1
  419.     '
  420.     ' For every section in SETUP.LST that needs to be installed, call CopySection
  421.     ' with the name of the section
  422.     '
  423.     CopySection gstrINI_FILES
  424.     'CopySection "MySection"
  425.     'CopySection "MyOtherSection"
  426.         
  427.     '
  428.     ' If you created an options dialog, you need to check results here to
  429.     ' determine whether to copy the files in the particular section(s).
  430.     '
  431.     'If chkInstallSamples.Value = TRUE then
  432.     '    CopySection "Samples"
  433.     'End If
  434.     '
  435.     UpdateStatus frmCopy.picStatus, 1, True
  436.     HideCopyDialog
  437.     '
  438.     ' If we installed AXDIST.EXE, we now need to run it
  439.     ' so it will install any additional files it contains.
  440.     '
  441.     If gfAXDist = True Then
  442.         '
  443.         'Synchronously shell out and run the utility with the correct switches
  444.         '
  445.         If FileExists(gstrAXDISTInstallPath) Then
  446.             SyncShell gstrAXDISTInstallPath, INFINITE, , True
  447.         End If
  448.     End If
  449.     '
  450.     '
  451.     ' If we installed WINt351.EXE, we now need to run it
  452.     ' so it will install any additional files it contains.
  453.     '
  454.     If gfWINt351 = True Then
  455.         '
  456.         'Synchronously shell out and run the utility with the correct switches
  457.         '
  458.         If FileExists(gstrWINt351InstallPath) Then
  459.             SyncShell gstrWINt351InstallPath, INFINITE, , True
  460.         End If
  461.     End If
  462.     '
  463.     ' Now, do all the 'invisible' update things that are required
  464.     '
  465.     SetMousePtr vbDefault
  466.     ShowStaticMessageDialog ResolveResString(resUPDATING)
  467.     '
  468.     ' Register all the files that have been saved in the registration array.  The
  469.     ' CopySection API adds a registration entry (when required) if a file is copied.
  470.     '
  471.     RegisterFiles
  472.     '
  473.     ' Register all the licenses that appear in the [Licenses] section of
  474.     ' Setup.lst.
  475.     '
  476.     RegisterLicenses
  477.     '
  478.     ' If any DAO files were installed, we need to add some special
  479.     ' keys to the registry to support it so that links will work
  480.     ' in OLE Database fields.
  481.     '
  482.     If gfRegDAO = True Then
  483.         RegisterDAO
  484.     End If
  485.     '
  486.     ' Create program icons (or links, i.e. shortcuts).
  487.     '
  488.     If (fMainGroupWasCreated = True) Or ((cIcons > 0) And TreatAsWin95()) Then
  489.         ShowStaticMessageDialog ResolveResString(resPROGMAN)
  490.         CreateIcons gsICONGROUP
  491.         '
  492.         ' Do the same for other sections in SETUP.LST if you've added your own.
  493.         '
  494.         'CreateIcons "MySection"
  495.         'CreateIcons "MyOtherSection"
  496.         '
  497.     End If
  498.     '
  499.     ' Create a separate program group and icons for the Remote Automation
  500.     ' Connection Manager and the Automation Manager, if either has been
  501.     ' installed.
  502.     ' This program group is entirely separate from the one created for the
  503.     ' application program (if any), because it will be shared by all
  504.     ' VB applications which install them.
  505.     '
  506.     ' NOTE: This is NOT the place to install additional icons.  This is
  507.     ' NOTE: handled after the Remote Automation icons have been created.
  508.     '
  509.     ShowStaticMessageDialog ResolveResString(resPROGMAN)
  510.     If gsDest.strAUTMGR32 <> "" Or gsDest.strRACMGR32 <> "" Then
  511.         'At least one of these programs was installed.  Go ahead
  512.         'and create the program group.
  513.         Dim strRemAutGroupName As String
  514.         
  515.         strRemAutGroupName = ResolveResString(resREMAUTGROUPNAME)
  516.         '
  517.         ' Create the group for the Remote Automation Icons.  Note that
  518.         ' since the user cannot choose the name of this group, there is
  519.         ' no way at this point to correct an error if one occurs.  Therefore,
  520.         ' fCreateOSProgramGroup will abort setup, without returning, if there
  521.         ' is an error.
  522.         '
  523.         fCreateOSProgramGroup frmSetup1, strRemAutGroupName, False, False
  524.         'Now create the icons for AUTMGR32.EXE and RACMGR32.EXE
  525.         If gsDest.strRACMGR32 <> "" Then
  526.             CreateOSLink frmSetup1, strRemAutGroupName, gsDest.strRACMGR32, "", ResolveResString(resRACMGR32ICON), True, gsPROGMENUKEY, False
  527.         End If
  528.         If gsDest.strAUTMGR32 <> "" Then
  529.             CreateOSLink frmSetup1, strRemAutGroupName, gsDest.strAUTMGR32, "", ResolveResString(resAUTMGR32ICON), True, gsPROGMENUKEY, False
  530.         End If
  531.     End If
  532.     '
  533.     'Register the per-app path
  534.     '
  535.     If gstrAppExe <> "" Then
  536.         Dim strPerAppPath As String
  537.         strPerAppPath = ReadIniFile(gstrSetupInfoFile, gstrINI_SETUP, gstrINI_APPPATH)
  538.         AddPerAppPath gstrAppExe, gsDest.strAppDir, strPerAppPath
  539.     End If
  540. ExitSetup:
  541.     HideStaticMessageDialog
  542.     RestoreProgMan
  543.     If fWithinAction() Then
  544.         'By now, all logging actions should have been either aborted or committed.
  545.         MsgError ResolveResString(resSTILLWITHINACTION), vbExclamation Or vbOKOnly, gstrTitle
  546.         ExitSetup Me, gintRET_FATAL
  547.     End If
  548.     MoveAppRemovalFiles strGroupName
  549.     ExitSetup Me, gintRET_FINISHEDSUCCESS
  550. MainError:
  551.     Dim iRet As Integer
  552.     iRet = MsgError(Error$ & vbLf & vbLf & ResolveResString(resUNEXPECTED), vbRetryCancel Or vbExclamation, gstrTitle)
  553.     If gfNoUserInput Then iRet = vbCancel
  554.     Select Case iRet
  555.         Case vbRetry
  556.             Resume
  557.         Case vbCancel
  558.             ExitSetup Me, gintRET_ABORT
  559.             Resume
  560.         'End Case
  561.     End Select
  562. End Sub
  563. '-----------------------------------------------------------
  564. ' SUB: HideCopyDialog
  565. ' Unloads the copy files status form
  566. '-----------------------------------------------------------
  567. Private Sub HideCopyDialog()
  568.     Unload frmCopy
  569. End Sub
  570. '-----------------------------------------------------------
  571. ' SUB: HideStaticMessageDialog
  572. ' Unloads the setup messages form
  573. '-----------------------------------------------------------
  574. Private Sub HideStaticMessageDialog()
  575.     Unload frmMessage
  576. End Sub
  577. '-----------------------------------------------------------
  578. ' SUB: ShowBeginForm
  579. ' Displays the begin setup form
  580. '-----------------------------------------------------------
  581. Private Sub ShowBeginForm()
  582.     If gfNoUserInput Then
  583.         If IsValidDestDir(gstrDestDir) = False Then
  584.             ExitSetup frmSetup1, gintRET_FATAL
  585.         End If
  586.     Else
  587.         frmBegin.Show vbModal
  588.     End If
  589. End Sub
  590. '-----------------------------------------------------------
  591. ' SUB: ShowCopyDialog
  592. ' Displays the copy files status form
  593. '-----------------------------------------------------------
  594. Private Sub ShowCopyDialog()
  595.     CenterForm frmCopy
  596.     frmCopy.Show
  597.     frmCopy.Refresh
  598.     If gfNoUserInput = True Then
  599.         frmCopy.cmdExit.Visible = False
  600.     Else
  601.         frmCopy.cmdExit.SetFocus
  602.     End If
  603. End Sub
  604. '-----------------------------------------------------------
  605. ' SUB: ShowMainForm
  606. ' Displays the main setup 'blue wash' form
  607. '-----------------------------------------------------------
  608. Private Sub ShowMainForm()
  609.     Me.Caption = gstrTitle
  610.     Me.Show
  611.     DrawBackGround
  612.     Me.Refresh
  613. End Sub
  614. '-----------------------------------------------------------
  615. ' SUB: ShowStaticMessageDialog
  616. ' Displays a setup message in a 'box' of the appropriate
  617. ' size for the message
  618. ' IN: [strMessage] - message to display
  619. '-----------------------------------------------------------
  620. Private Sub ShowStaticMessageDialog(ByVal strMessage As String)
  621.     Dim frm As Form
  622.     Set frm = frmMessage
  623.     frm.lblMsg.Caption = strMessage
  624.     '
  625.     'Default height is twice the height of the setup icon.
  626.     'If the height of the message text is greater, then
  627.     'increase the form height to the label height plus
  628.     'half an icon height
  629.     '
  630.     frm.ScaleHeight = frm.imgMsg.Height * 2
  631.     If frm.lblMsg.Height > frm.ScaleHeight Then
  632.         frm.ScaleHeight = frm.lblMsg.Height + frm.imgMsg.Height * 0.5
  633.     End If
  634.     '
  635.     'Vertically center the icon and label within the form
  636.     '
  637.     frm.imgMsg.Top = frm.ScaleHeight / 2 - frm.imgMsg.Height / 2
  638.     frm.lblMsg.Top = frm.ScaleHeight / 2 - frm.lblMsg.Height / 2
  639.     CenterForm frm
  640.     frm.Show
  641.     frm.Refresh
  642. End Sub
  643. '-----------------------------------------------------------
  644. ' SUB: ShowWelcomeForm
  645. ' Displays the welcome to setup form
  646. '-----------------------------------------------------------
  647. Private Sub ShowWelcomeForm()
  648.     If Not gfNoUserInput Then
  649.         frmWelcome.Show vbModal
  650.     End If
  651. End Sub
  652. '-----------------------------------------------------------
  653. ' SUB: GetStrings
  654. ' Loads string resources into global vars and forms/controls
  655. '-----------------------------------------------------------
  656. Private Sub GetStrings()
  657.     On Error GoTo GSErr
  658.     gstrSETMSG = ResolveResString(resSETMSG)
  659.     Exit Sub
  660. GSErr:
  661.     MsgError mstrRESOURCELOADFAIL, vbCritical Or vbOKOnly, vbNullString
  662.     ExitSetup Me, gintRET_FATAL
  663. End Sub
  664. Private Sub Form_Unload(Cancel As Integer)
  665.     'Get rid of the cab file in the windows dir (if it exists).
  666.     Dim lCount As Long
  667.     Dim sCab As String
  668.     Dim sTemp As String
  669.     lCount = 0
  670.     'Get rid of the cab file in the windows dir (if it exists).
  671.     Do
  672.         If gintCabs = 1 Then
  673.             sCab = gstrWinDir
  674.             AddDirSep sCab
  675.             sCab = sCab & BaseName(gsCABNAME)
  676.             If FileExists(sCab) Then Kill sCab
  677.             Exit Do
  678.         End If
  679.         lCount = lCount + 1
  680.         sCab = gstrWinDir
  681.         AddDirSep sCab
  682.         sTemp = Left(gsCABNAME, Len(gsCABNAME) - 5) & CStr(lCount) & gstrSEP_EXT & gsINI_CABNAME
  683.         sCab = sCab & BaseName(sTemp)
  684.         If FileExists(sCab) Then
  685.             Kill sCab
  686.         Else
  687.             Exit Do
  688.         End If
  689.     Loop
  690. End Sub
  691.